import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
const path = require("path");
export default defineConfig({
  root: path.resolve(__dirname, "./src"),
  plugins: [react()],
  //开发服务器配置

  server: {
    port: 3000, //端口
    open: true, // 开启后自动打开浏览器
  },

  //构建配置
  build: {
    outDir: path.resolve(__dirname, "./dist"), //打包输出目录
    assetsInlineLimit: 4096, // 小于4kb的资源内联为base64,
    rollupOptions: {
      output: {
        manualChunks: {
          //手动拆分代码，将react和react-dom拆分为单独的chunk
          reawct: ["react", "react-dom"],
        },
      },
    },
  },
});
